/****************************************************************************************/
/*                                                                     					*/
/*  M16C/62P Group Program Collection                                  					*/
/*                                                                     					*/
/*  FILE NAME : command.h                                       						*/
/*  CPU       : This program is the Serial flash boot loader by Xmodem data transfer	*/
/*  HISTORY   : 2006.12.08 Ver 0.01                                    					*/
/*                                                                    	 				*/
/*  Copyright (C) 2006. Renesas Technology Corp.                       					*/
/*  Copyright (C) 2006. Renesas Solutions Corp.                        					*/
/*  All right reserved.                                                					*/
/*                                                                     					*/
/*****************************************************************************************/

#ifndef _COMMAND_H
#define _COMMAND_H

#include "flash_header.h"

#define	FIRST_USER_FLASH_BLK	2
#define LAST_USER_FLASH_ADDR	0xFBFFF

#if(ROM_SIZE == ROM_SIZE_512KB)
#define FIRST_USER_FLASH_ADDR	0x80000L
#define FIRST_USER_FL_ADDR_TXT	"00080000"
#elif(ROM_SIZE == ROM_SIZE_384KB)
#define FIRST_USER_FLASH_ADDR	0xA0000L
#define FIRST_USER_FL_ADDR_TXT	"000A0000"
#endif

#define RESET_VECTOR_OFFSET		0x20

#define INT_RAM_BASE_ADDRESS	0x3000

void InitCommandHandler (void);
void RunCommandHandler (void);
void ShowMenu (void);
void Command_1 (void);
void Command_2 (void);
void Command_3 (void);
void Command_4 (void);
void Command_5 (void);
void reverse(char s[]);
void itoa(long n, char s[], unsigned char base);

typedef unsigned char (*pt2FunctionErase)(unsigned long, unsigned short * );

#define	RAM_BASED_ROM_ADDRESS			0x000FE600
#define	RAM_BASED_ROM_STOPPER_ADDRESS	0x000FFC00
#define	SIZE_OF_RAM_BASED_ROM			(RAM_BASED_ROM_STOPPER_ADDRESS-RAM_BASED_ROM_ADDRESS)

#endif
